# import pandas as pd
#
# job_list = ["算法", "软件", "前端", "人工智能", "数据", "Android", "Java", "安卓", "运维", "图像"]
# input_file = "./data4_3_classify_job/salary_execl.xlsx"
# data1 = pd.read_excel(input_file)
# print("原始数据Pandas: ")
# print(data1.head())
# data1 = data1.values
# print("转换为NumPy数据: ")
# print(data1[:5])
# for job in job_list:
#     print("正在分离包含有\"{}\"的".format(job) + "数据")
#     output_file = "./data4_3_classify_job/{}.xlsx".format(job)
#     job_name = []
#     company_name = []
#     salary = []
#     address = []
#     education_requirements = []
#     for item in data1:
#         if job in item[0]:
#             job_name.append(item[0])
#             company_name.append(item[1])
#             salary.append(item[2])
#             address.append(item[3])
#             education_requirements.append(item[4])
#     data2 = {
#         "job_name": job_name,
#         "company_name": company_name,
#         "salary": salary,
#         "address": address,
#         "education_requirements": education_requirements
#     }
#     data2 = pd.DataFrame(data2)
#     data2.to_excel(output_file)

import pandas as pd

job_list=['算法','软件','前端','人工智能','数据','Android','Java','安卓','运维','图像']
input_file='./data4_3_classify_job./salary_execl.xlsx'
data1=pd.read_excel(input_file)
print('原始数据Pandas：')
print(data1.head())
data1=data1.values
print('转换成Numpy数据：')
print(data1[:5])
for job in job_list:
    print("正在分离包含有\"{}\"的".format(job)+"数据")
    output_file='./data4_3_classify_job/{}'.format(job)+".xlsx"
    job_name=[]
    company_name=[]
    salary=[]
    address=[]
    education_requirements=[]
    for item in data1:
        if job in item[0]:
            job_name.append(item[0])
            company_name.append(item[1])
            salary.append(item[2])
            address.append(item[3])
            education_requirements.append(item[4])
    data2 = {"job_name": job_name, 'company_name': company_name, 'salary': salary, "address": address, "education_requirements": education_requirements}
    data2 = pd.DataFrame(data2)
    data2.to_excel(output_file)